<?php

class CommonController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
     }
    
    public function exportabletoexcelviewAction(){
    	$this->_helper->layout->disableLayout();
    	$hdvalueexport = $this->_request->getParam('hdvalueexport','');
    	echo '<script>
			$(document).ready(function() {
				 $("#txtname").val("'.$hdvalueexport.'");
			     $("#btnexporttoexcel").click(function(event) {
			     	$("#tabletoexcel").val( $("<div>").append( $("#'.$hdvalueexport.'").eq(0).clone()).html());
			     	$("#frm_exporttoexcel").submit();
				});
				$("#btnexporttoexcelcerrar").click(function(event) {
					closelight2();
				});
			});    	
    	</script>';
    	
    }
    public function exportabletoexcelAction(){
    	
    	#$this->_helper->getHelper('ajaxContext')->initContext();
    	$this->_helper->viewRenderer->setNoRender();
    	$this->_helper->layout->disableLayout();
    	#if($this->getRequest()->isXmlHttpRequest()){
    		$tableexcel = $this->_request->getPost('tabletoexcel');
    		$nameexcel = $this->_request->getPost('txtname');
    		header("Content-type: application/vnd.ms-excel; name='excel'");
    		header("Content-Disposition: filename=".$nameexcel.".xls");
    		header("Pragma: no-cache");
    		header("Expires: 0");
    		echo $tableexcel;
    	#}
    }


}

